<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
    
//  for(var pai=0;pai<54;pai++){
// if(pai<52){
// switch(parseInt(pai/13)){
// case 0:var huase='黑桃';var color='black';break;
// case 1:var huase='红桃';var color='red';break;
// case 2:var huase='梅花';var color='black';break;
// case 3:var huase='方片';var color='red';break;
// }
// var num=pai%13+1;
// switch(num){
// case 1:num='A';break;
// case 11:num='J';break;
// case 12:num='Q';break;
// case 13:num='K';break;
// }
// }else if(pai==52){
// var huase='小王';var color='black';
// var num='';
// }else{
// var huase='大王';var color='red';
// var num='';
// }
// document.write('<font color="'+color+'">'+huase+num+'</font><br />');
// }
//     
const pools = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "大王", "小王"];
const types = ["♠", "♥", "♣", "♦"];

function getRandom(pools, types, count) {
  const arr = [];
  for (let i = 0; i < count; i++) {
    let pool = pools[Math.floor(Math.random() * pools.length)];
    let type = types[Math.floor(Math.random() * types.length)];
    let poker = pool === '大王' || pool === '小王' ? pool : type + pool;
    arr.indexOf(poker) == -1 ? arr.push(poker) : i--;
  }
  return arr;
}

document.write(getRandom(pools, types,3));
</script>
</body>
</html>